package com.shenma2009.controller;

import com.shenma2009.domain.ResultResponse;
import com.shenma2009.service.TbUserService;
import com.shenma2009.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 军哥
 * @version 1.0
 * @description: TbUserController
 * @date 2023/4/19 15:50
 */

@RestController
@Slf4j
@RequestMapping(value = "/user")
public class TbUserController {

    @Autowired
    TbUserService tbUserService;

    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody TbUserVo tbUserVo) {
        return tbUserService.add(tbUserVo);
    }

    @PostMapping(value = "/del")
    public ResultResponse del(@RequestBody IdVo idVo) {
        return tbUserService.del(idVo);
    }

    @PostMapping(value = "/set")
    public ResultResponse set(@RequestBody TbUserVo tbUserVo) {
        return tbUserService.set(tbUserVo);
    }

    @PostMapping(value = "/get")
    public ResultResponse get(@RequestBody IdVo idVo) {
        return tbUserService.get(idVo);
    }

    @PostMapping(value = "/list")
    public ResultResponse list(@RequestBody PageVo pageVo) {
        return tbUserService.listByPage(pageVo);
    }

    @PostMapping(value = "/resetUserPass")
    public ResultResponse resetUserPass(@RequestBody UserPassVo userPassVo) {
        return tbUserService.resetUserPass(userPassVo);
    }

    @PostMapping(value = "/login")
    public ResultResponse login(@RequestBody LoginInfoVo loginInfoVo) {
        return tbUserService.login(loginInfoVo);
    }
}
